﻿using System;
using NJabber.Client.StanzaFactories;
using NJabber.Stream.Elements;

namespace NJabber
{
    public static class ConvertHelper
    {
        public static string AvailabilityStatusToString(AvailabilityStatus status)
        {
            switch (status)
            {
                case AvailabilityStatus.None:
                    return string.Empty;

                case AvailabilityStatus.Away:
                    return AvailabilityType.Away;

                case AvailabilityStatus.Chat:
                    return AvailabilityType.Chat;

                case AvailabilityStatus.DoNotDisturb:
                    return AvailabilityType.DoNotDisturb;

                case AvailabilityStatus.ExtendedAway:
                    return AvailabilityType.ExtendedAway;

                default:
                    throw new NotImplementedException();
            }
        }

        internal static AvailabilityStatus StringToAvailabilityStatus(string statusType)
        {
            switch (statusType)
            {
                case "":
                    return AvailabilityStatus.None;

                case "away":
                    return AvailabilityStatus.Away;

                case "chat":
                    return AvailabilityStatus.Chat;

                case "dnd":
                    return AvailabilityStatus.DoNotDisturb;

                case "xa":
                    return AvailabilityStatus.ExtendedAway;

                default:
                    throw new NotImplementedException();
            }
        }
    }
}
